import Mock from 'mockjs';
import setupMock from '@/utils/setupMock';


const data = {
    "effects": true,
    "createTime": 1598256269,
    "updateTime": 1619316645,
    "_id": "5f43748d94c942f8bc6daa87",
    "avatarRotate": false,
    "introduction": "There is a kind of call to eat together.",
    "homeBgImg": "http://nevergiveupt.top/index.jpg",
    "archiveBgImg": "http://nevergiveupt.top/archive.jpg",
    "categoriesBgImg": "http://nevergiveupt.top/category.jpg",
    "categoriesDetailBgImg": "http://nevergiveupt.top/category.jpg",
    "tagsBgImg": "http://nevergiveupt.top/tags.jpg",
    "tagsDetailBgImg": "http://nevergiveupt.top/tags.jpg",
    "aboutBgImg": "http://nevergiveupt.top/about.jpg",
    "avatar": "http://img.nevergiveupt.top/d962de99454167348513dd191fe20698.jpeg"
}


setupMock({
    setup: () => {
        Mock.mock(new RegExp('/api/site/home'), 'get', () => {
            return {
                msg: "查询成功",
                code: 200,
                data
            }
        });

        Mock.mock(new RegExp('/api/site/home'), 'post', (params) => {
            console.log('---', params);
            const data = JSON.parse(params.body);
            return {
                msg: "保存成功",
                code: 200,
                data
            }
        });

        Mock.mock(new RegExp('/api/site/home'), 'put', (params) => {
            const data = JSON.parse(params.body);
            console.log('---', params);
            return {
                msg: "修改成功",
                code: 200,
                data
            }
        });
    },
});
